package com.quectel.core.module.propertybill.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author zhangheng
 * @email nolan.zhang@quectel.com
 * @date 2023/4/13 13:12
 * @description 账单计费单位和时长
 */
@Schema
@Data
public class PropertyBillCycleDateInfoVo implements Serializable {
    @Schema(description = "账单所属年份")
    private Integer year;

    @Schema(description = "账期类型")
    private Byte periodType;

    @Schema(description = "账单所属时间段")
    private Integer periodValue;

    @Schema(description = "账期名称:年份+时间+收费标准名称")
    private String periodName;

    @Schema(description = "开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startDate;

    @Schema(description = "结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endDate;

    @Schema(description = "赠送月数")
    private Integer giveMonths = 0;

    @Schema(description = "自身价值月数")
    private Integer selfMonths = 0;

    @Schema(description = "总共月数")
    private Integer totalMonths = 0;

    @Schema(description = "逾期缴费时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date overdueDate;

    @Schema(description = "逾期天数")
    private Long overdueDays;

    @Schema(description = "逾期状态")
    private Byte overdueStatus;

    public Integer getTotalMonths() {
        return this.selfMonths + this.giveMonths;
    }


}
